# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: team/gnome <ablocorrea@hotmail.com>
pkgname=nautilus
pkgver=45.2.1
pkgrel=0
pkgdesc="GNOME file manager"
url="https://wiki.gnome.org/Apps/Nautilus"
# s390x blocked by mozjs91 -> tracker-miners
arch="all !s390x"
license="GPL-2.0-or-later"
depends="
	desktop-file-utils
	gsettings-desktop-schemas
	tracker-miners
	"
depends_dev="
	gnome-autoar-dev
	gnome-desktop-dev
	"
makedepends="
	$depends_dev
	docbook-xml
	docbook-xsl
	gexiv2-dev
	gst-plugins-base-dev
	itstool
	jpeg-dev
	libadwaita-dev
	libcloudproviders-dev
	libexif-dev
	libportal-dev
	librsvg-dev
	libseccomp-dev
	libxml2-dev
	libxml2-utils
	libxslt
	meson
	tiff-dev
	tracker-dev
	tracker-testutils
	"
checkdepends="dbus appstream-glib"
subpackages="$pkgname-dev $pkgname-lang"
source="https://download.gnome.org/sources/nautilus/${pkgver%%.*}/nautilus-$pkgver.tar.xz
	meson-fix-mixed-list.patch
	"

if [ "$CARCH" = "armhf" ]; then
	options="!check" # one test fails on armhf
fi

# secfixes:
#   3.32.1-r0:
#     - CVE-2019-11461

build() {
	abuild-meson \
		-Db_lto=true \
		-Dtests=headless \
		. output
	meson compile -C output
}

check() {
	test_list=$(meson test --list -C output) 2> /dev/null
	# Remove test known to fail upstream
	# https://gitlab.gnome.org/GNOME/nautilus/-/issues/3115
	# https://gitlab.gnome.org/GNOME/tracker-miners/-/issues/278
	test_list=${test_list//test-nautilus-search-engine-tracker}

	XDG_RUNTIME_DIR="$(mktemp -d -p "$builddir")" \
	dbus-run-session -- \
	meson test --no-rebuild --print-errorlogs -C output $test_list
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

sha512sums="
c1e26e9f802f62ccb7a7d60f895575a1b31d8071f6a60206472fe79f70d64717b9abe97a5c5c0c87349994ff6f144dfe97c7bd448a05a9da00ff9918884e65fa  nautilus-45.2.1.tar.xz
d08c6833343b8ed89515d12063938e7236cb37d15b7115de50a43bd9a049a09a5a2fc907f52675ba85abecef9bae82c7848249872908eeb39c5c49a744cbf9d1  meson-fix-mixed-list.patch
"
